package com.zhuss.advice.complaint;

import com.zhuss.bean.bo.advice.Complaint.*;
import com.zhuss.bean.bo.advice.Complaint.weChat.CreateComplaintWeChatBo;
import com.zhuss.common.OperateService;
import com.zhuss.common.Processor;
import com.zhuss.exception.WpsException;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

/**
 * @Author: zhushanshuo
 * @Date: 2020/3/6 9:05
 */
@Component("complaintOperateService")
public class ComplaintOperateService implements OperateService<Void, Object> {

    @Autowired
    @Qualifier("complaintCreate")
    private Processor<Object, CreateComplaintBo> complaintCreate;

    @Autowired
    @Qualifier("complaintUpdate")
    private Processor<Object, UpdateComplaintBo> complaintUpdate;

    @Autowired
    @Qualifier("complaintDelete")
    private Processor<Object, DeleteComplaintBo> complaintDelete;

    @Autowired
    @Qualifier("complaintAssigned")
    private Processor<Object, AssignedComplaintBo> complaintAssigned;

    @Autowired
    @Qualifier("complaintSign")
    private Processor<Object, SignComplaintBo> complaintSign;

    @Autowired
    @Qualifier("complaintReply")
    private Processor<Object, ReplyComplaintBo> complaintReply;

    @Autowired
    @Qualifier("complaintDeal")
    private Processor<Object, DealComplaintBo> complaintDeal;

    @Override
    public Void create(Object o) throws WpsException {
        CreateComplaintBo bo = (CreateComplaintBo) o;
        complaintCreate.process(bo);
        return null;
    }

    @Override
    public Void update(Object o) throws WpsException {
        UpdateComplaintBo bo = (UpdateComplaintBo) o;
        complaintUpdate.process(bo);
        return null;
    }

    @Override
    public Void delete(Object o) throws WpsException {
        DeleteComplaintBo bo = (DeleteComplaintBo) o;
        complaintDelete.process(bo);
        return null;
    }

    /**
     * 交办
     * @throws WpsException
     */
    public Void assigned(Object o) throws WpsException {
        AssignedComplaintBo bo = (AssignedComplaintBo) o;
        complaintAssigned.process(bo);
        return null;
    }

    /**
     * 签收
     * @throws WpsException
     */
    public Void sign(Object o) throws WpsException {
        SignComplaintBo bo = (SignComplaintBo) o;
        complaintSign.process(bo);
        return null;
    }

    /**
     * 回复
     * @throws WpsException
     */
    public Void reply(Object o) throws WpsException {
        ReplyComplaintBo bo = (ReplyComplaintBo) o;
        complaintReply.process(bo);
        return null;
    }

    /**
     * 处理
     * @throws WpsException
     */
    public Void deal(Object o) throws WpsException {
        DealComplaintBo bo = (DealComplaintBo) o;
        complaintDeal.process(bo);
        return null;
    }

    /**
     * 微信新建
     * @throws WpsException
     */
    public Void weChatCreate(Object o) throws WpsException {
        CreateComplaintWeChatBo bo = (CreateComplaintWeChatBo) o;
        CreateComplaintBo ccb = new CreateComplaintBo();
        BeanUtils.copyProperties(bo,ccb);
        complaintCreate.process(ccb);
        return null;
    }
}
